home *** CD-ROM | disk | FTP | other *** search
/ Know Your Baseball - The Greatest Player Resource / Know Your Baseball - Greatest Player.iso / Baseball / Director / KTGCST.CST / 00063_Script_ButtonKit < prev    next >
Text File  |  1998-09-21  |  7KB  |  268 lines

  1.  
  2. ------------------ Init List For Button State Tracking --------------------
  3.  
  4. -- called from on startmovie or the first exitframe script in the movie
  5. -- loads a default list of 0
  6. -- the list is used by ButtonKit to set the positions to 1 to
  7. -- track which buttons are on or off
  8.  
  9. global gButtonState,gHion,gOpning
  10.  
  11. on initButtonKit
  12.   set gButtonState = []
  13.   repeat with x = 1 to 48
  14.     append gbuttonState,0
  15.   end repeat  
  16. end
  17.  
  18. ------------------- Three State Button --------------------------------------
  19.  
  20. -- if a button has three states then call ThreeStateButton as the first line in any scripts
  21. -- that are attached to the button
  22.  
  23. on ThreeStateButton
  24.   set mybutton = the clickon
  25.   set one = getat(gbuttonState, mybutton)
  26.   if one = 0 then 
  27.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  28.     setat(gbuttonState, mybutton,2) 
  29.   end if
  30. end
  31.  
  32. -- for balls in the field
  33. on ThreeStateBall
  34.   set mybutton = the clickon
  35.   set one = getat(gbuttonState, mybutton)
  36.   if one = 0 then 
  37.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  38.     setat(gbuttonState, mybutton,2) 
  39.     setat(gbuttonState, (mybutton-20),2)
  40.   end if
  41.   loadaudiomedia (mybutton)
  42. end
  43.  
  44. --- for Roles
  45. on ThreeStatePlayers
  46.   set mybutton = the clickon
  47.   set one = getat(gbuttonState, mybutton)
  48.   if one = 0 then 
  49.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  50.     setat(gbuttonState, mybutton,2) 
  51.   end if
  52.   -- loadaudiomedia(mybutton)
  53. end
  54.  
  55.  
  56. --- for balls in roles where the players have threestates
  57. on ThreeStateBallR
  58.   set gOpning = EMPTY
  59.   set mybutton = the clickon
  60.   set one = getat(gbuttonState, mybutton)
  61.   if one = 0 then 
  62.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  63.     set player = mybutton-20
  64.     set the membernum of sprite player = the membernum of sprite player +1
  65.     setat(gbuttonState, mybutton,2) 
  66.     setat(gbuttonState, (player),2)
  67.   end if
  68.   loadAudioMedia(mybutton)
  69. end
  70.  
  71. on ThreeStateBallRg
  72.   set gOpning = EMPTY
  73.   set mybutton = the clickon
  74.   set one = getat(gbuttonState, mybutton)
  75.   if one = 0 then 
  76.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  77.     setat(gbuttonState, mybutton,2) 
  78.   end if
  79.   loadAudioMedia(mybutton)
  80. end
  81.  
  82. on TwoStateField
  83.   set gOpning = EMPTY
  84.   set mybutton = the clickon+10
  85.   set one = getat(gbuttonState, mybutton)
  86.   if one = 0 then 
  87.     setat(gbuttonState, (mybutton,1)
  88.     set the membernum of sprite mybutton = the membernum of sprite mybutton+1 
  89.     set the blend of sprite mybutton = 100
  90.   end if
  91.   loadAudioMedia(mybutton)
  92. end
  93. -------------------------- Two State Buttons --------------------------
  94.  
  95. on TwoStateField2
  96.   set gOpning = EMPTY
  97.   set mybutton = the clickon+6
  98.   set one = getat(gbuttonState, mybutton)
  99.   if one = 0 then 
  100.     setat(gbuttonState, (mybutton,1)
  101.     set the membernum of sprite mybutton = the membernum of sprite mybutton+1 
  102.     set the blend of sprite mybutton = 100
  103.   end if
  104.   loadAudioMedia(mybutton)
  105. end
  106.  
  107. on TwoStateButton
  108.   set gOpning = EMPTY
  109.   set mybutton = the clickon
  110.   setat(gButtonState,mybutton,1)
  111. end
  112.  
  113.  
  114. ------------------------- Reset Button States -----------------------------------
  115.  
  116. -- toggles off any button that any ready on 
  117. -- these scripts are placed in the second line of a button handler
  118. -- after ThreeStateButton or twostatebutton
  119. -- they are divided into groups attach the correct group to you handler
  120. on resetBalls
  121.   set mybutton = the clickon
  122.   repeat with y = 31 down to 25
  123.     set thisone = getat(gbuttonState,y)
  124.     if thisone > 0 and y <> mybutton then 
  125.       set the blend of sprite y = 0
  126.       set the blend of sprite y-20 = 0
  127.       set the membernum of sprite y = the membernum of sprite y -1
  128.       setat(gbuttonState,y,0)
  129.       setat(gbuttonState,y-20,0)
  130.       exit repeat
  131.     end if
  132.   end repeat 
  133.   updatestage 
  134. end
  135.  
  136. on resetBallsR
  137.   set mybutton = the clickon
  138.   repeat with y = 31 down to 25
  139.     set thisone = getat(gbuttonState,y)
  140.     if thisone > 0 and y <> mybutton then 
  141.       set the blend of sprite y = 0
  142.       set the blend of sprite y-20 = 0
  143.       set the membernum of sprite y = the membernum of sprite y -1
  144.       set player = y-20
  145.       set the membernum of sprite player = the membernum of sprite player -1
  146.       setat(gbuttonState,y,0)
  147.       setat(gbuttonState,player,0)
  148.       exit repeat
  149.     end if
  150.   end repeat 
  151.   updatestage 
  152. end
  153.  
  154. on resetField
  155.   set mybutton = (the clickon)+10
  156.   repeat with y = 31 down to 25
  157.     set thisone = getat(gbuttonState,y)
  158.     if thisone > 0 and y <> mybutton then 
  159.       set the blend of sprite y = 0
  160.       set the blend of sprite y-20 = 0
  161.       set the membernum of sprite y = the membernum of sprite y-1
  162.       setat(gbuttonState,y,0)
  163.       setat(gbuttonState,y-20,0)
  164.       exit repeat
  165.     end if
  166.   end repeat 
  167.   updatestage 
  168. end
  169.  
  170. on resetField2
  171.   set mybutton = (the clickon)+6--for the edges in field defence
  172.   repeat with y = 31 down to 25
  173.     set thisone = getat(gbuttonState,y)
  174.     if thisone > 0 and y <> mybutton then 
  175.       set the blend of sprite y = 0
  176.       set the blend of sprite y-20 = 0
  177.       set the membernum of sprite y = the membernum of sprite y-1
  178.       setat(gbuttonState,y,0)
  179.       setat(gbuttonState,y-20,0)
  180.       exit repeat
  181.     end if
  182.   end repeat 
  183.   
  184.   
  185.   
  186.   updatestage 
  187. end
  188. --- attach to buttons
  189. on resetsweater
  190.   set mybutton = the clickon
  191.   repeat with y = 38 down to 34
  192.     set thisone = getat(gbuttonState,y)
  193.     if thisone > 0 and y <> mybutton then 
  194.       set the blend of sprite y = 0
  195.       set the membernum of sprite y = the membernum of sprite y -1
  196.       setat(gbuttonState,y,0)
  197.       exit repeat
  198.     end if
  199.   end repeat 
  200.   updatestage
  201. end
  202.  
  203. on resetbanner
  204.   set mybutton = the clickon
  205.   repeat with y = 47 down to 39
  206.     set thisone = getat(gbuttonState,y)
  207.     if thisone > 0 and y <> mybutton then 
  208.       set the blend of sprite y = 0
  209.       set the membernum of sprite y = the membernum of sprite y -1
  210.       setat(gbuttonState,y,0)
  211.       exit repeat
  212.     end if
  213.   end repeat 
  214. end
  215.  
  216. on resetbannerAlt b -- alternate to mouseup script in rules
  217.   global gRbook
  218.   case gRBook of
  219.     "soccer":
  220.       set mybutton = 40
  221.     "micro":
  222.       set mybutton = b
  223.   end case
  224.   
  225.   put mybutton
  226.   repeat with y = 47 down to 39
  227.     set thisone = getat(gbuttonState,y)
  228.     if thisone > 0 and y <> mybutton then 
  229.       set the blend of sprite y = 0
  230.       set the membernum of sprite y = the membernum of sprite y -1
  231.       setat(gbuttonState,y,0)
  232.       exit repeat
  233.     end if
  234.   end repeat 
  235.   updatestage
  236. end
  237.  
  238. -- for rules
  239. on resettabs1
  240.   set mybutton = the clickon
  241.   put mybutton
  242.   repeat with y = 33 down to 30
  243.     set thisone = getat(gbuttonState,y)
  244.     if thisone > 0 and y <> mybutton then 
  245.       set the blend of sprite y = 0
  246.       setat(gbuttonState,y,0)
  247.       exit repeat
  248.     end if
  249.   end repeat 
  250.   updatestage
  251. end
  252.  
  253. on resettabs2
  254.   set mybutton = the clickon
  255.   put mybutton
  256.   repeat with y = 37 down to 34
  257.     set thisone = getat(gbuttonState,y)
  258.     if thisone > 0 and y <> mybutton then 
  259.       set the blend of sprite y = 0
  260.       setat(gbuttonState,y,0)
  261.       exit repeat
  262.     end if
  263.   end repeat 
  264.   updatestage
  265. end
  266.  
  267.  
  268.